unit untCadRegionaisEdicao;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, untAbsEdicao, Vcl.ImgList, Vcl.ActnList,
  Vcl.ComCtrls, Vcl.ToolWin, Vcl.ExtCtrls, Data.DB, Data.Win.ADODB,
  Vcl.StdCtrls, Vcl.Mask, Vcl.DBCtrls;

type
  TfrmCadRegionaisEdicao = class(TfrmAbsEdicao)
    qryRegionais: TADOQuery;
    dtsRegionais: TDataSource;
    qryRegionaisID: TAutoIncField;
    qryRegionaisNOME_RAZAO: TStringField;
    qryRegionaisNOME_FANTASIA: TStringField;
    qryRegionaisINSCRICAO: TStringField;
    qryRegionaisCNPJ: TStringField;
    qryRegionaisENDERECO: TStringField;
    qryRegionaisBAIRRO: TStringField;
    qryRegionaisCEP: TStringField;
    qryRegionaisCIDADE: TStringField;
    qryRegionaisUF: TStringField;
    qryRegionaisTEL_1: TStringField;
    qryRegionaisTEL_2: TStringField;
    qryRegionaisTEL_3: TStringField;
    qryRegionaisDT_CADASTRO: TDateTimeField;
    Label2: TLabel;
    DBEdit2: TDBEdit;
    Label3: TLabel;
    DBEdit3: TDBEdit;
    Label4: TLabel;
    DBEdit4: TDBEdit;
    Label5: TLabel;
    DBEdit5: TDBEdit;
    Label6: TLabel;
    DBEdit6: TDBEdit;
    Label7: TLabel;
    DBEdit7: TDBEdit;
    Label8: TLabel;
    DBEdit8: TDBEdit;
    Label9: TLabel;
    DBEdit9: TDBEdit;
    Label10: TLabel;
    DBEdit10: TDBEdit;
    Label11: TLabel;
    DBEdit11: TDBEdit;
    Label12: TLabel;
    DBEdit12: TDBEdit;
    Label13: TLabel;
    DBEdit13: TDBEdit;
    Label1: TLabel;
    Label15: TLabel;
    DBEdit1: TDBEdit;
    datePicker: TDateTimePicker;
    procedure qryRegionaisAfterOpen(DataSet: TDataSet);
    procedure dtsRegionaisStateChange(Sender: TObject);
    procedure qryRegionaisCNPJGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmCadRegionaisEdicao: TfrmCadRegionaisEdicao;

implementation

{$R *.dfm}

uses untDTMPrincipal, FuncoesGenericas;

procedure TfrmCadRegionaisEdicao.dtsRegionaisStateChange(Sender: TObject);
begin
  inherited;
  AtualizarBotoes;
end;

procedure TfrmCadRegionaisEdicao.qryRegionaisAfterOpen(DataSet: TDataSet);
begin
  if qryRegionaisDT_CADASTRO.IsNull then
    datePicker.DateTime := Now
  else
    datePicker.DateTime := qryRegionaisDT_CADASTRO.AsDateTime;
end;

procedure TfrmCadRegionaisEdicao.qryRegionaisCNPJGetText(Sender: TField;
  var Text: string; DisplayText: Boolean);
begin
  inherited;
  Text := FormatarCPFCNPJ(Sender.AsString);
end;

end.
